#ifndef BOFUGUI_H
#define BOFUGUI_H

#include <QMainWindow>
#include <QItemSelection>
#include <QtGui/QFileSystemModel>
#include <QtGui/QListView>
#include <QSettings>
#include <QFileDialog>
#include <QUrl>
#include <QScrollBar>
#include <QDesktopServices>
#include <QFileInfoListIterator>
#include <QMessageBox>
#include <iostream>
#include <fstream>
#include <QDir>
#include <QFile>
#include <QTextStream>
#include <QtXml/QDomDocument>
#include <QtXml/QDomText>
#include <QtXml/QDomElement>
#include <QtXml/QDomNode>
#include "QTime"
#include "QSqlTableModel"
#include "QSqlDatabase"
#include "QSqlError"
#include "QSqlDriver"

class QLabel;
class QLineEdit;
class QPushButton;
class QAction;

namespace Ui {
    class BofuGui;
}

class BofuGui : public QMainWindow {
    Q_OBJECT
public:
    BofuGui(QWidget *parent = 0);
    ~BofuGui();



protected:
    void changeEvent(QEvent *e);

private:
    Ui::BofuGui *ui;
    QFileSystemModel *model;
    QSettings settings;

    /*
     *For Command-Execution
     */
    QString command;
    int commandexec;


    QString lexfile;
    QString phoxsysymbolsfile;
    QString korpusname;                   //Name of the folder

    QDir exe;                                //executable directory name
    QDir dir;                                //active directory name
    QDir bofu;                              //bofupath
    QDir lamFolder;                              //bofupath
      /*
     *The needed Files (needed for exist-checks)
     */
    QFile transcriptionfile;
    QFile convert_tables;
    QFile dict;
    QFile filelist_path;
    QFile unitlist;
    QFile filelist;
    QFile contextfile;
    QFile boss3conf;
    QFile exception_lexicon;

private slots:
    //functions

    void on_pushButton_editUnitlist_clicked();
    void on_pushButton_createUnitlist_clicked();
    void about();
    void copyFile(QString, QString);
    void waitSecs( int );
    void writeToLog( QString );
    void openURL( QUrl );
    void errorFiles();
    void scriptDone();
    void on_pushButton_checkCMDs_clicked();

    //Settings
    void writeSettings();
    void readSettings();

    //tab4
    void on_pushButton_wagon_clicked();
    void on_pushButton_cartTrainfile_clicked();
    void on_pushButton_openCartDescription_clicked();
    void on_pushButton_CreateCartDescription_clicked();
    void on_pushButton_CreateCartTrain_clicked();
    void on_pushButton_CreatePreselection_clicked();
    void on_pushButton_preselectionFolder_clicked();
    void on_pushButton_CreateModuleOrder_clicked();
    void on_pushButton_EditModuleOrder_clicked();

    //bofugui
    void on_pushButton_Accept_clicked();
    void on_actionBOSS_Doku_triggered();
    void on_pushButton_ResetAll_clicked();
    void on_filelistDefaultButton_2_clicked();
    void selectionHandle(const QItemSelection &selected, const QItemSelection &deselected);
    void guided();
    void enableAll();
    void on_deleteButton_clicked();
    void on_showFolderButton_clicked();
    void on_actionBeenden_triggered();
    void on_actionDaten_importieren_triggered();
    void on_actionKorpus_Erstellung_triggered();
    void on_korpusNameButton_clicked();
    void on_importButton_clicked();
    void on_newButton_clicked();

    //database_view
    int on_pushButton_CreateDB_clicked();
    bool createConnection();
    bool createUserConnection();
    int on_pushButton_deleteTables_clicked();
    int on_pushButton_insertTables_clicked();
    void on_pushButton_insertLexicon_clicked();
    void on_pushButton_importLexicon_clicked();
    void on_pushButton_editLexicon_clicked();
    void on_pushButton_blfxml2db_clicked();
    void on_action_Export_active_project_triggered();

    //log
    void on_pushButton_refreshfolder_clicked();
    void check_existing_files();
    void on_pushButton_openLog_clicked();
    void on_pushButton_DeleteLog_clicked();
    void logDate();
    void on_pushButton_showLog_clicked();


    //tab3
    void on_pushButton_CreateSQL_clicked();
    void on_pushButton_OpenSQLFolder_clicked();
    void on_pushButton_EditConfig_clicked();
    void on_pushButton_CreateConfig_clicked();
    void on_lab2blfButton_clicked();
    void on_wav2rawButton_clicked();
    void on_raw2wavButton_clicked();
    void on_addmelboundsButton_clicked();
    void on_addF0Button_clicked();
    void on_optBoundsButton_clicked();
    void on_addHPButton_clicked();
    void on_addContextButton_clicked();
    void on_alignFlagButton_clicked();
    void on_addPhrasesButton_clicked();
    void on_editContextButton_clicked();
    void on_blf2xmlButton_clicked();
    void on_getF0BossButton_clicked();

    //align_tab
    void on_lam4HTKButton_1_clicked();
    void on_lam4HTKButton_2_clicked();
    void on_lam4HTKButton_3_clicked();
    void on_exportButton_clicked();
    void on_labelimportButton_clicked();
    void on_labelimportButton_2_clicked();
    void on_decodingButton_clicked();

    //Tab2
    void on_pushButton_importUnitlist_clicked();
    void on_codingButton_clicked();
    void on_pushButton_createDict_clicked();

    //Tab1
    void on_pushButton_importFileList_clicked();
    void on_pushButton_loadWav_clicked();
    void on_pushButton_createFileList_clicked();
    void on_pushButton_importTranscription_clicked();
    void on_pushButton_importOrthographic_clicked();
    void on_lexiconLoadButton_clicked();
    void on_transcribeButton_clicked();

    //Diary
    void enableSafeButton(const QString &text);
    void enableDiarySafeButton();
    void on_pushButton_DiarySafe_clicked();

    //synth
    void enableSynthButton(const QString &text);
    void enableMultiSynthButton();
    void on_pushButton_synthfolder_clicked();
    void on_pushButton_multiSynth_clicked();
    void on_pushButton_Synth_clicked();


    void on_pushButton_browsePhoxysymbols_clicked();
};

#endif // BOFUGUI_H
